package com.xma.springcloud.alibaba.controller;

import com.xma.springcloud.alibaba.entity.TtOrder;
import com.xma.springcloud.alibaba.service.TtOrderService;
import com.xma.springcloud.common.ResponseResult;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * (TtOrder)表控制层
 *
 * @author makejava
 * @since 2020-07-06 19:53:15
 */
@RestController
public class TtOrderController {
    /**
     * 服务对象
     */
    @Resource
    private TtOrderService ttOrderService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("/selectOne")
    public TtOrder selectOne(@PathVariable("id") Long id) {
        return this.ttOrderService.queryById(id);
    }

    @GetMapping("/order/create")
    public ResponseResult create(TtOrder order){
        ttOrderService.insert(order);
        return new ResponseResult(200,"订单创建成功");
    }

}